<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Template Units For Numerical Applications</title>
<link href="TUNAstyles.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
<style type="text/css">

.cabeza_cell {
  border-left: 1px solid #000000;
  border-right: 1px solid #000000;
  border-bottom: 1px solid #000000;
  border-top: 1px solid #000000;
  font-family: Arial,Helvetica,sans-serif;
  font-size: 11pt;
  background-color: #ffffff;
  font-weight: lighter;
  color: #000000;
  text-decoration: none;
}
</style>

</head><body>
<div>
<table align="center" width="640" border="0" cellspacing="2" cellpadding="5" class="border">
<tr>
 <td class="cabeza_cell"> 

  <font style="font-family: helvetica; color: #000000;" size=4>
    <font style="font-family: helvetica; color: #336699; font-weight=bold" size=5>TUNA</font> :
    <font style="font-family: helvetica; color: #336699; font-weight=bold" size=5>T</font>emplate
    <font style="font-family: helvetica; color: #336699; font-weight=bold" size=5>U</font>nits for
    <font style="font-family: helvetica; color: #336699; font-weight=bold" size=5>N</font>umerical 
    <font style="font-family: helvetica; color: #336699; font-weight=bold" size=5>A</font>pplications
 </font><br>
  
</td>
</tr>

<tr>
<td class="cabeza_cell">
 <span style="font-family: helvetica; color: #336699;">
 Documentation Ver 1.0.0 August 2011 by
 <a href="http://mmc.geofisica.unam.mx/luiggi">Luis M. de la Cruz</a> <br>
 <a href="http://mmc.geofisica.unam.mx"> GMMC </a> -
 <a href="http://www.geofisica.unam.mx/recnat/"> Depto. de Recursos Naturales </a> -
 <a href="http://www.geofisica.unam.mx"> Instituto de Geof&iacute;sica </a> -
 <a href="http://www.unam.mx"> UNAM </a><br>
 </span>
 </td>

</tr>

</table>
</div>
<br>
<!-- Generated by Doxygen 1.7.4 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">Tuna/include/Equations/GeneralEquation.hpp</div>  </div>
</div>
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*------------------------------------------------------------------------</span>
<a name="l00002"></a>00002 <span class="comment"> *  Copyright (C) 2011  Luis M. de la Cruz Salas</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> *  This file is part of TUNA</span>
<a name="l00005"></a>00005 <span class="comment"> *</span>
<a name="l00006"></a>00006 <span class="comment"> *  TUNA is free software: you can redistribute it and/or modify</span>
<a name="l00007"></a>00007 <span class="comment"> *  it under the terms of the GNU General Public License as published by</span>
<a name="l00008"></a>00008 <span class="comment"> *  the Free Software Foundation, either version 3 of the License, or</span>
<a name="l00009"></a>00009 <span class="comment"> *  (at your option) any later version.</span>
<a name="l00010"></a>00010 <span class="comment"> *</span>
<a name="l00011"></a>00011 <span class="comment"> *  TUNA is distributed in the hope that it will be useful,</span>
<a name="l00012"></a>00012 <span class="comment"> *  but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00013"></a>00013 <span class="comment"> *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00014"></a>00014 <span class="comment"> *  GNU General Public License for more details.</span>
<a name="l00015"></a>00015 <span class="comment"> *</span>
<a name="l00016"></a>00016 <span class="comment"> *  You should have received a copy of the GNU General Public License</span>
<a name="l00017"></a>00017 <span class="comment"> *  along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.</span>
<a name="l00018"></a>00018 <span class="comment"> ------------------------------------------------------------------------*/</span>
<a name="l00019"></a>00019 
<a name="l00020"></a>00020 <span class="preprocessor">#ifndef _GENERALEQUATION_H_</span>
<a name="l00021"></a>00021 <span class="preprocessor"></span><span class="preprocessor">#define _GENERALEQUATION_H_</span>
<a name="l00022"></a>00022 <span class="preprocessor"></span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include &lt;map&gt;</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &quot;<a class="code" href="Tuna_8hpp.html" title="Types and structures to be used inside of TUNA.">Tuna.hpp</a>&quot;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &quot;Storage/SparseMatrix.hpp&quot;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &quot;Storage/Diagonal.hpp&quot;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &quot;Utils/num_utils.hpp&quot;</span>
<a name="l00029"></a>00029 
<a name="l00030"></a>00030 <span class="keyword">namespace </span>Tuna {
<a name="l00031"></a>00031 
<a name="l00045"></a>00045 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Teq&gt;
<a name="l00046"></a><a class="code" href="classTuna_1_1GeneralEquation.html">00046</a> <span class="keyword">class </span><a class="code" href="classTuna_1_1GeneralEquation.html" title="General class for equations.">GeneralEquation</a> {
<a name="l00047"></a>00047 <span class="keyword">public</span>:
<a name="l00048"></a>00048   
<a name="l00050"></a><a class="code" href="classTuna_1_1GeneralEquation.html#a39e7293ae9e10a2fc90f422da1d28ecd">00050</a>   <span class="keyword">typedef</span> <span class="keyword">typename</span> Typeinfo&lt;Teq&gt;::prec_t <a class="code" href="classTuna_1_1GeneralEquation.html#a39e7293ae9e10a2fc90f422da1d28ecd" title="Precision used for the numerical operations.">prec_t</a>;
<a name="l00051"></a>00051   <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="structTuna_1_1TunaArray.html" title="tiny used mainly for extents and deltas of meshes (blitz-TinyVector based) and huge used for general ...">TunaArray&lt;prec_t, Typeinfo&lt;Teq&gt;::Dim</a> &gt;::tiny floatTinyArray_t; 
<a name="l00052"></a>00052   <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="structTuna_1_1TunaArray.html" title="tiny used mainly for extents and deltas of meshes (blitz-TinyVector based) and huge used for general ...">TunaArray&lt;prec_t, Typeinfo&lt;Teq&gt;::Dim</a> &gt;::huge ScalarField; 
<a name="l00053"></a>00053   <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="structTuna_1_1TunaArray.html" title="tiny used mainly for extents and deltas of meshes (blitz-TinyVector based) and huge used for general ...">TunaArray&lt;prec_t,1&gt;::huge</a> ScalarField1D;
<a name="l00054"></a>00054   <span class="keyword">typedef</span> map&lt;BC_t, prec_t&gt; BC_mapping;  
<a name="l00055"></a>00055   <span class="keyword">typedef</span> SparseMatrix&lt; Diagonal&lt; prec_t, Typeinfo&lt;Teq&gt;::Dim &gt; &gt; DiagMat;
<a name="l00056"></a>00056 
<a name="l00057"></a>00057 
<a name="l00058"></a>00058   <a class="code" href="classTuna_1_1GeneralEquation.html#a674b04baf966a2a4f3b772f166e11642" title="Default constructor.">GeneralEquation</a>();
<a name="l00059"></a>00059   <a class="code" href="classTuna_1_1GeneralEquation.html#a674b04baf966a2a4f3b772f166e11642" title="Default constructor.">GeneralEquation</a>(ScalarField&amp;, DiagMat&amp;, ScalarField&amp;);
<a name="l00060"></a>00060   <a class="code" href="classTuna_1_1GeneralEquation.html#a674b04baf966a2a4f3b772f166e11642" title="Default constructor.">GeneralEquation</a>(ScalarField&amp;, DiagMat&amp;, ScalarField&amp;, <span class="keyword">const</span> floatTinyArray_t&amp;);
<a name="l00061"></a>00061   ~<a class="code" href="classTuna_1_1GeneralEquation.html" title="General class for equations.">GeneralEquation</a>() { }; 
<a name="l00066"></a><a class="code" href="classTuna_1_1GeneralEquation.html#aac63dc10324dcfdd7aaabdc63ec0c67f">00066</a>   <span class="keyword">inline</span> Teq&amp; <a class="code" href="classTuna_1_1GeneralEquation.html#aac63dc10324dcfdd7aaabdc63ec0c67f" title="The Curiously Recursive Template Pattern (CRTP) is used.">asDerived</a>() { <span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span>Teq&amp;<span class="keyword">&gt;</span>(*this); }
<a name="l00067"></a>00067    
<a name="l00068"></a>00068 <span class="comment">//  </span>
<a name="l00069"></a>00069 <span class="comment">// ----- Setup parameters of the equation</span>
<a name="l00070"></a>00070 <span class="comment">//</span>
<a name="l00071"></a>00071 
<a name="l00072"></a>00072   <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html#afab260da87049ae64d98f3b9b959887b" title="Setup the Linear System.">setLinearSystem</a>(DiagMat&amp;, ScalarField &amp;);
<a name="l00073"></a>00073 
<a name="l00074"></a>00074   <span class="keyword">inline</span> <span class="keywordtype">void</span> setDeltas(<span class="keyword">const</span> floatTinyArray_t&amp; deltas) {
<a name="l00075"></a>00075     dx = deltas(0); 
<a name="l00076"></a>00076     <span class="keywordflow">if</span>( Dim &gt; 1) dy = deltas(1); 
<a name="l00077"></a>00077     <span class="keywordflow">if</span>( Dim &gt; 2) dz = deltas(2);
<a name="l00078"></a>00078   }  
<a name="l00079"></a>00079 
<a name="l00080"></a>00080   <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Tmesh&gt;
<a name="l00081"></a>00081   <span class="keyword">inline</span> <span class="keywordtype">void</span> setNonUniformMesh(Tmesh&amp; mesh) {
<a name="l00082"></a>00082     dxyz[0].resize( mesh.getExtentDeltasVols(X) );
<a name="l00083"></a>00083     dxyz[1].resize( mesh.getExtentDeltasVols(Y) );
<a name="l00084"></a>00084     dxyz[2].resize( mesh.getExtentDeltasVols(Z) );
<a name="l00085"></a>00085     dxyz[0] = mesh.getDeltasVols(X);
<a name="l00086"></a>00086     dxyz[1] = mesh.getDeltasVols(Y);
<a name="l00087"></a>00087     dxyz[2] = mesh.getDeltasVols(Z);    
<a name="l00088"></a>00088 
<a name="l00089"></a>00089     dface[0].resize( mesh.getExtentDeltasFace(X) );
<a name="l00090"></a>00090     dface[1].resize( mesh.getExtentDeltasFace(Y) );
<a name="l00091"></a>00091     dface[2].resize( mesh.getExtentDeltasFace(Z) );
<a name="l00092"></a>00092     dface[0] = mesh.getDeltasFace(X);
<a name="l00093"></a>00093     dface[1] = mesh.getDeltasFace(Y);
<a name="l00094"></a>00094     dface[2] = mesh.getDeltasFace(Z);
<a name="l00095"></a>00095 
<a name="l00096"></a>00096     dx = dxyz[0](1);
<a name="l00097"></a>00097     <span class="keywordflow">if</span> (Dim &gt;= 2) dy = dxyz[1](1);
<a name="l00098"></a>00098     <span class="keywordflow">if</span> (Dim == 3) dz = dxyz[2](1);
<a name="l00099"></a>00099 
<a name="l00100"></a>00100     cout &lt;&lt; <span class="stringliteral">&quot;\n dx = &quot;</span> &lt;&lt; dx;
<a name="l00101"></a>00101     cout &lt;&lt; <span class="stringliteral">&quot;\n dy = &quot;</span> &lt;&lt; dy;
<a name="l00102"></a>00102     cout &lt;&lt; <span class="stringliteral">&quot;\n dz = &quot;</span> &lt;&lt; dz;
<a name="l00103"></a>00103   }
<a name="l00104"></a>00104 
<a name="l00105"></a>00105   <span class="keyword">inline</span> <span class="keywordtype">void</span> setDeltaTime(prec_t ddt) { dt = ddt; }  
<a name="l00106"></a>00106 <span class="comment">//</span>
<a name="l00107"></a>00107 <span class="comment">// ----- Setup and apply boundary conditions</span>
<a name="l00108"></a>00108 <span class="comment">//</span>
<a name="l00109"></a>00109   <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html#a25136e525b1fe03af821d085080d4992" title="Setup Dirichlet boundary conditions on walls.">setDirichlet</a>(BC_t wall, prec_t w_v = 0.0);
<a name="l00110"></a>00110   <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html#af5cdc5a89b6c1c314bd203055ff456de" title="Setup Neumann boundary conditions on walls.">setNeumann</a>(BC_t wall, prec_t w_v = 0.0);  
<a name="l00111"></a>00111   <span class="keyword">inline</span> <span class="keywordtype">void</span> applyBoundaryConditions();
<a name="l00112"></a>00112   <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html#ae0dd56c6ade4cfc084c34ff5fd772c8f" title="Application of Dirichlet and Neumann boundary conditions in 1D.">applyBoundaryConditions1D</a>();
<a name="l00113"></a>00113   <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html#ae2b4682ab94f7bfe3d0a4956962a577e" title="Application of Dirichlet and Neumann boundary conditions in 2D.">applyBoundaryConditions2D</a>();
<a name="l00114"></a>00114   <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html#a3645e8125190644008ed8848f4ba3caf" title="Application of Dirichlet and Neumann boundary conditions in 3D.">applyBoundaryConditions3D</a>();
<a name="l00115"></a>00115   <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html#a7809997f260ee040de62a07629fa574e" title="Dirichlet boundary condition in 1D.">applyDirichlet1D</a>();
<a name="l00116"></a>00116   <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html#ae9e0bf89858afdba0282be1cbc12b072" title="Dirichlet boundary condition in 2D.">applyDirichlet2D</a>();
<a name="l00117"></a>00117   <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html#ac362ca4fe4517c17e47b1c3077fdc146" title="Dirichlet boundary condition in 3D.">applyDirichlet3D</a>();
<a name="l00118"></a>00118   <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html#a9e817253cb759e787244a4b917ee2ee9" title="Neumann boundary condition in 1D.">applyNeumann1D</a>();
<a name="l00119"></a>00119   <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html#ae11b4f1d25e239aba5e7feee69ab20dc" title="Neumann boundary condition in 2D.">applyNeumann2D</a>();
<a name="l00120"></a>00120   <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html#a9ad19dbf5779b235447ac056514b4eb9" title="Neumann boundary condition in 3D.">applyNeumann3D</a>();
<a name="l00121"></a>00121 
<a name="l00122"></a>00122   <span class="keyword">inline</span> <span class="keywordtype">void</span> applyBoundaryConditionsStagger1D();
<a name="l00123"></a>00123   <span class="keyword">inline</span> <span class="keywordtype">void</span> applyBoundaryConditionsStagger2D(Axis_t);
<a name="l00124"></a>00124   <span class="keyword">inline</span> <span class="keywordtype">void</span> applyBoundaryConditionsStagger3D(Axis_t);
<a name="l00125"></a>00125   <span class="keyword">inline</span> <span class="keywordtype">void</span> applyDirichletStagger1D();
<a name="l00126"></a>00126   <span class="keyword">inline</span> <span class="keywordtype">void</span> applyDirichletStagger2D(Axis_t);
<a name="l00127"></a>00127   <span class="keyword">inline</span> <span class="keywordtype">void</span> applyDirichletStagger3D(Axis_t);
<a name="l00128"></a>00128 
<a name="l00129"></a>00129   <span class="keyword">inline</span> <span class="keywordtype">void</span> set_bi(<span class="keywordtype">int</span> bbi) {bi = bbi;}
<a name="l00130"></a>00130   <span class="keyword">inline</span> <span class="keywordtype">void</span> set_bj(<span class="keywordtype">int</span> bbj) {bj = bbj;}
<a name="l00131"></a>00131   <span class="keyword">inline</span> <span class="keywordtype">void</span> set_bk(<span class="keywordtype">int</span> bbk) {bk = bbk;}
<a name="l00132"></a>00132   <span class="keyword">inline</span> <span class="keywordtype">void</span> set_ei(<span class="keywordtype">int</span> eei) {ei = eei;}
<a name="l00133"></a>00133   <span class="keyword">inline</span> <span class="keywordtype">void</span> set_ej(<span class="keywordtype">int</span> eej) {ej = eej;}
<a name="l00134"></a>00134   <span class="keyword">inline</span> <span class="keywordtype">void</span> set_ek(<span class="keywordtype">int</span> eek) {ek = eek;}
<a name="l00135"></a>00135 
<a name="l00136"></a>00136 <span class="comment">//</span>
<a name="l00137"></a>00137 <span class="comment">// ----- Get</span>
<a name="l00138"></a>00138 <span class="comment">//</span>
<a name="l00139"></a>00139   <span class="keyword">inline</span> <span class="keyword">const</span> ScalarField&amp; get_phi()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> phi; }
<a name="l00140"></a>00140   <span class="keyword">inline</span> ScalarField&amp; get_phi(Range &amp;r) { <span class="keywordflow">return</span> phi(r); }
<a name="l00141"></a>00141   <span class="keyword">inline</span> <span class="keyword">const</span> ScalarField&amp; get_aP(Range &amp;r)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> aP(r); }
<a name="l00142"></a>00142   <span class="keyword">inline</span> <span class="keyword">const</span> ScalarField&amp; get_aE(Range &amp;r)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> aE(r); }
<a name="l00143"></a>00143   <span class="keyword">inline</span> <span class="keyword">const</span> ScalarField&amp; get_aW(Range &amp;r)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> aW(r); }
<a name="l00144"></a>00144   <span class="keyword">inline</span> <span class="keyword">const</span> ScalarField&amp; get_aN(Range &amp;r)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> aN(r); }
<a name="l00145"></a>00145   <span class="keyword">inline</span> <span class="keyword">const</span> ScalarField&amp; get_aS(Range &amp;r)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> aS(r); }
<a name="l00146"></a>00146   <span class="keyword">inline</span> <span class="keyword">const</span> ScalarField&amp; get_aF(Range &amp;r)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> aF(r); }
<a name="l00147"></a>00147   <span class="keyword">inline</span> <span class="keyword">const</span> ScalarField&amp; get_aB(Range &amp;r)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> aB(r); }
<a name="l00148"></a>00148   <span class="keyword">inline</span> <span class="keyword">const</span> ScalarField&amp; get_sp(Range &amp;r)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> sp(r); }
<a name="l00149"></a>00149   <span class="keyword">inline</span> <span class="keywordtype">int</span> get_bi()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> bi; }
<a name="l00150"></a>00150   <span class="keyword">inline</span> <span class="keywordtype">int</span> get_ei()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> ei; }
<a name="l00151"></a>00151   <span class="keyword">inline</span> <span class="keywordtype">int</span> get_bj()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> bj; }
<a name="l00152"></a>00152   <span class="keyword">inline</span> <span class="keywordtype">int</span> get_ej()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> ej; }
<a name="l00153"></a>00153   <span class="keyword">inline</span> <span class="keywordtype">int</span> get_bk()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> bk; }
<a name="l00154"></a>00154   <span class="keyword">inline</span> <span class="keywordtype">int</span> get_ek()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> ek; }
<a name="l00155"></a>00155   <span class="keyword">inline</span> prec_t getDx() { <span class="keywordflow">return</span> dx; }
<a name="l00156"></a>00156   <span class="keyword">inline</span> prec_t getDy() { <span class="keywordflow">return</span> dy; }
<a name="l00157"></a>00157   <span class="keyword">inline</span> prec_t getDz() { <span class="keywordflow">return</span> dz; }
<a name="l00158"></a>00158   <span class="keyword">inline</span> prec_t getDt() { <span class="keywordflow">return</span> dt; }
<a name="l00159"></a>00159 
<a name="l00160"></a>00160 <span class="comment">//</span>
<a name="l00161"></a>00161 <span class="comment">// ----- Useful functions</span>
<a name="l00162"></a>00162 <span class="comment">//</span>
<a name="l00163"></a>00163   <span class="keyword">inline</span> <span class="keywordtype">double</span> calcResidual();
<a name="l00164"></a>00164   <span class="keyword">inline</span> prec_t calcErrorL2() { <span class="keywordflow">return</span> NumUtils::calcErrorL2(phi_0, phi); }
<a name="l00165"></a>00165   <span class="keyword">inline</span> prec_t calcErrorL1() { <span class="keywordflow">return</span> NumUtils::calcErrorL1(phi_0, phi); }
<a name="l00166"></a>00166   <span class="keyword">inline</span> prec_t calcErrorLmax() { <span class="keywordflow">return</span> NumUtils::calcErrorLmax(phi_0, phi); }
<a name="l00167"></a>00167 
<a name="l00168"></a>00168   <span class="keywordtype">double</span> getResidual() { <span class="keywordflow">return</span> residual; }
<a name="l00169"></a>00169   <span class="keywordtype">void</span> update();
<a name="l00170"></a>00170   <span class="keywordtype">void</span> updatePhi(ScalarField &amp;s) { phi = s; } 
<a name="l00171"></a>00171   <span class="keyword">inline</span> <span class="keywordtype">bool</span> applyBounds(<span class="keywordtype">int</span> bbi, <span class="keywordtype">int</span> eei)
<a name="l00172"></a>00172   {
<a name="l00173"></a>00173     bi = bbi; ei = eei;
<a name="l00174"></a>00174   }
<a name="l00175"></a>00175   <span class="keyword">inline</span> <span class="keywordtype">bool</span> applyBounds(<span class="keywordtype">int</span> bbi, <span class="keywordtype">int</span> eei,
<a name="l00176"></a>00176                           <span class="keywordtype">int</span> bbj, <span class="keywordtype">int</span> eej)
<a name="l00177"></a>00177   {
<a name="l00178"></a>00178     bi = bbi; ei = eei; 
<a name="l00179"></a>00179     bj = bbj; ej = eej; 
<a name="l00180"></a>00180   } 
<a name="l00181"></a>00181   <span class="keyword">inline</span> <span class="keywordtype">bool</span> applyBounds(<span class="keywordtype">int</span> bbi, <span class="keywordtype">int</span> eei,
<a name="l00182"></a>00182                           <span class="keywordtype">int</span> bbj, <span class="keywordtype">int</span> eej,
<a name="l00183"></a>00183                           <span class="keywordtype">int</span> bbk, <span class="keywordtype">int</span> eek)
<a name="l00184"></a>00184   {
<a name="l00185"></a>00185     bi = bbi; ei = eei; 
<a name="l00186"></a>00186     bj = bbj; ej = eej; 
<a name="l00187"></a>00187     bk = bbk; ek = eek; 
<a name="l00188"></a>00188   }  
<a name="l00189"></a>00189   <span class="keywordtype">void</span> print(<span class="keywordtype">int</span> rank = -1);
<a name="l00190"></a>00190 
<a name="l00191"></a>00191 <span class="keyword">protected</span>:
<a name="l00192"></a>00192   <span class="keywordtype">int</span> Dim;
<a name="l00193"></a>00193   <span class="keywordtype">string</span> name;
<a name="l00194"></a>00194   prec_t dx, dy, dz, dt, residual;
<a name="l00195"></a>00195   ScalarField1D dxyz[3], dface[3];  
<a name="l00196"></a>00196   <span class="keywordtype">int</span> bi, ei, bj, ej, bk, ek;
<a name="l00197"></a>00197   BC_mapping dirichlet, neumann;
<a name="l00198"></a>00198         
<a name="l00199"></a>00199 <span class="keyword">public</span>:
<a name="l00200"></a>00200   ScalarField phi;
<a name="l00201"></a>00201   ScalarField aE, aW, aN, aS, aF, aB, aP, sp;
<a name="l00202"></a>00202 
<a name="l00203"></a>00203 <span class="keyword">private</span>:
<a name="l00204"></a>00204   ScalarField phi_0;
<a name="l00205"></a>00205 };
<a name="l00206"></a>00206   
<a name="l00210"></a>00210 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Teq&gt;
<a name="l00211"></a><a class="code" href="classTuna_1_1GeneralEquation.html#a674b04baf966a2a4f3b772f166e11642">00211</a> <a class="code" href="classTuna_1_1GeneralEquation.html#a674b04baf966a2a4f3b772f166e11642" title="Default constructor.">GeneralEquation&lt;Teq&gt;::GeneralEquation</a> ()
<a name="l00212"></a>00212 {
<a name="l00213"></a>00213   Dim = Typeinfo&lt;Teq&gt;::Dim;
<a name="l00214"></a>00214   dx = 1.0; dy = 1.0; dz = 1.0; dt = 1.0;
<a name="l00215"></a>00215   bi = 0; ei = 1; bj = 0; ej = 1; bk = 0; ek = 1;
<a name="l00216"></a>00216 } 
<a name="l00217"></a>00217   
<a name="l00222"></a>00222 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Teq&gt;
<a name="l00223"></a><a class="code" href="classTuna_1_1GeneralEquation.html#a45df58f46b2fd27ade2da0c69bf273fd">00223</a> <a class="code" href="classTuna_1_1GeneralEquation.html#a674b04baf966a2a4f3b772f166e11642" title="Default constructor.">GeneralEquation&lt;Teq&gt;::GeneralEquation</a>(ScalarField &amp;phi_global, 
<a name="l00224"></a>00224                                       DiagMat &amp;matrix, ScalarField &amp;b)
<a name="l00225"></a>00225 {
<a name="l00226"></a>00226   Dim = Typeinfo&lt;Teq&gt;::Dim;
<a name="l00227"></a>00227   dx = 1.0; dy = 1.0; dz = 1.0; dt = 1.0;
<a name="l00228"></a>00228 
<a name="l00229"></a>00229   <span class="comment">// phi is a copy of a global field variable and </span>
<a name="l00230"></a>00230   <span class="comment">// store the new solution.</span>
<a name="l00231"></a>00231   phi.resize(phi_global.shape());
<a name="l00232"></a>00232   phi = phi_global;
<a name="l00233"></a>00233 
<a name="l00234"></a>00234   <span class="comment">// phi_0 is a reference of a global field variable</span>
<a name="l00235"></a>00235   <span class="comment">// and stores the previous solution</span>
<a name="l00236"></a>00236   phi_0.reference(phi_global);
<a name="l00237"></a>00237 
<a name="l00238"></a>00238   bi = bj = bk = 0; ei = ej = ek = 1;
<a name="l00239"></a>00239 
<a name="l00240"></a>00240   <span class="keywordflow">if</span> (Dim &gt;= 1) {
<a name="l00241"></a>00241     bi = phi.lbound(firstDim);  ei = phi.ubound(firstDim);
<a name="l00242"></a>00242   } 
<a name="l00243"></a>00243   <span class="keywordflow">if</span> (Dim &gt;= 2) {
<a name="l00244"></a>00244     bj = phi.lbound(secondDim); ej = phi.ubound(secondDim);
<a name="l00245"></a>00245   }
<a name="l00246"></a>00246   <span class="keywordflow">if</span> (Dim == 3) {
<a name="l00247"></a>00247     bk = phi.lbound(thirdDim);  ek = phi.ubound(thirdDim);
<a name="l00248"></a>00248   }
<a name="l00249"></a>00249   setLinearSystem(matrix, b);
<a name="l00250"></a>00250 }
<a name="l00251"></a>00251 
<a name="l00256"></a>00256 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Teq&gt;
<a name="l00257"></a><a class="code" href="classTuna_1_1GeneralEquation.html#a71eebad555f8c90bcd26fc011afdc8a7">00257</a> <a class="code" href="classTuna_1_1GeneralEquation.html#a674b04baf966a2a4f3b772f166e11642" title="Default constructor.">GeneralEquation&lt;Teq&gt;::GeneralEquation</a>(ScalarField &amp;phi_global, 
<a name="l00258"></a>00258                                       DiagMat &amp;matrix, ScalarField &amp;b,
<a name="l00259"></a>00259                                       <span class="keyword">const</span> floatTinyArray_t&amp; deltas) 
<a name="l00260"></a>00260 {
<a name="l00261"></a>00261   Dim = Typeinfo&lt;Teq&gt;::Dim;
<a name="l00262"></a>00262   dx = 1.0; dy = 1.0; dz = 1.0; dt = 1.0;
<a name="l00263"></a>00263 
<a name="l00264"></a>00264   <span class="comment">// phi is a copy of a global field variable and </span>
<a name="l00265"></a>00265   <span class="comment">// store the new solution.</span>
<a name="l00266"></a>00266   phi.resize(phi_global.shape());
<a name="l00267"></a>00267   phi = phi_global;
<a name="l00268"></a>00268 
<a name="l00269"></a>00269   <span class="comment">// phi_0 is a reference of a global field variable</span>
<a name="l00270"></a>00270   <span class="comment">// and stores the previous solution</span>
<a name="l00271"></a>00271   phi_0.reference(phi_global);
<a name="l00272"></a>00272 
<a name="l00273"></a>00273   bi = bj = bk = 0; ei = ej = ek = 1;
<a name="l00274"></a>00274 
<a name="l00275"></a>00275   <span class="keywordflow">if</span> (Dim &gt;= 1) {
<a name="l00276"></a>00276     bi = phi.lbound(firstDim);  ei = phi.ubound(firstDim);
<a name="l00277"></a>00277   } 
<a name="l00278"></a>00278   <span class="keywordflow">if</span> (Dim &gt;= 2) {
<a name="l00279"></a>00279     bj = phi.lbound(secondDim); ej = phi.ubound(secondDim);
<a name="l00280"></a>00280   }
<a name="l00281"></a>00281   <span class="keywordflow">if</span> (Dim == 3) {
<a name="l00282"></a>00282     bk = phi.lbound(thirdDim);  ek = phi.ubound(thirdDim);
<a name="l00283"></a>00283   }
<a name="l00284"></a>00284   setLinearSystem(matrix, b);
<a name="l00285"></a>00285   setDeltas(deltas);
<a name="l00286"></a>00286 }
<a name="l00287"></a>00287 
<a name="l00293"></a>00293 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Teq&gt;
<a name="l00294"></a>00294 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html#afab260da87049ae64d98f3b9b959887b" title="Setup the Linear System.">GeneralEquation&lt;Teq&gt;::setLinearSystem</a>
<a name="l00295"></a><a class="code" href="classTuna_1_1GeneralEquation.html#afab260da87049ae64d98f3b9b959887b">00295</a> (DiagMat &amp;matrix, ScalarField &amp;b )
<a name="l00296"></a>00296 {
<a name="l00297"></a>00297   aP.reference(matrix.store(0)); <span class="comment">// main diagonal</span>
<a name="l00298"></a>00298   aE.reference(matrix.store(1)); <span class="comment">// upper diagonal</span>
<a name="l00299"></a>00299   aW.reference(matrix.store(2)); <span class="comment">// lower diagonal</span>
<a name="l00300"></a>00300   <span class="keywordflow">if</span>(Dim &gt;= 2) {
<a name="l00301"></a>00301     aN.reference(matrix.store(3)); <span class="comment">// second upper diagonal</span>
<a name="l00302"></a>00302     aS.reference(matrix.store(4)); <span class="comment">// second lower diagonal</span>
<a name="l00303"></a>00303   }
<a name="l00304"></a>00304   <span class="keywordflow">if</span>(Dim == 3) {
<a name="l00305"></a>00305     aF.reference(matrix.store(5)); <span class="comment">// third upper diagonal</span>
<a name="l00306"></a>00306     aB.reference(matrix.store(6)); <span class="comment">// third lower diagonal</span>
<a name="l00307"></a>00307   }
<a name="l00308"></a>00308   sp.reference(b); <span class="comment">// right-hand side </span>
<a name="l00309"></a>00309 }
<a name="l00310"></a>00310 
<a name="l00311"></a>00311 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Teq&gt;
<a name="l00312"></a>00312 <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html" title="General class for equations.">GeneralEquation&lt;Teq&gt;::print</a>(<span class="keywordtype">int</span> rank) 
<a name="l00313"></a>00313 {
<a name="l00314"></a>00314   <span class="keywordflow">if</span> (rank == -1)
<a name="l00315"></a>00315     std::cout &lt;&lt; <span class="stringliteral">&quot;\n +----- TUNA info -----+&quot;</span>
<a name="l00316"></a>00316               &lt;&lt; <span class="stringliteral">&quot;\n | GeneralEquation&lt; &quot;</span> &lt;&lt; name &lt;&lt; <span class="stringliteral">&quot;  &gt; &quot;</span>
<a name="l00317"></a>00317               &lt;&lt; <span class="stringliteral">&quot;\n +-----+&quot;</span>;
<a name="l00318"></a>00318   <span class="keywordflow">else</span>
<a name="l00319"></a>00319     std::cout &lt;&lt; <span class="stringliteral">&quot;\n +----- TUNA info -----+&quot;</span>
<a name="l00320"></a>00320               &lt;&lt; <span class="stringliteral">&quot;\n | Proc (&quot;</span> &lt;&lt; rank &lt;&lt; <span class="stringliteral">&quot;) : GeneralEquation&lt; &quot;</span> &lt;&lt; name &lt;&lt; <span class="stringliteral">&quot;  &gt; &quot;</span>
<a name="l00321"></a>00321               &lt;&lt; <span class="stringliteral">&quot;\n +-----+&quot;</span>;
<a name="l00322"></a>00322 
<a name="l00323"></a>00323   std::cout &lt;&lt; <span class="stringliteral">&quot;\n | bi = &quot;</span> &lt;&lt; bi &lt;&lt; <span class="stringliteral">&quot;\t ei = &quot;</span> &lt;&lt; ei
<a name="l00324"></a>00324             &lt;&lt; <span class="stringliteral">&quot;\n | bj = &quot;</span> &lt;&lt; bj &lt;&lt; <span class="stringliteral">&quot;\t ej = &quot;</span> &lt;&lt; ej
<a name="l00325"></a>00325             &lt;&lt; <span class="stringliteral">&quot;\n | bk = &quot;</span> &lt;&lt; bk &lt;&lt; <span class="stringliteral">&quot;\t ek = &quot;</span> &lt;&lt; ek
<a name="l00326"></a>00326             &lt;&lt; <span class="stringliteral">&quot;\n | dx = &quot;</span> &lt;&lt; dx &lt;&lt; <span class="stringliteral">&quot;\t dy = &quot;</span> &lt;&lt; dy
<a name="l00327"></a>00327             &lt;&lt; <span class="stringliteral">&quot;\n | dz = &quot;</span> &lt;&lt; dz &lt;&lt; <span class="stringliteral">&quot;\t dt = &quot;</span> &lt;&lt; dt    
<a name="l00328"></a>00328             &lt;&lt; <span class="stringliteral">&quot;\n +-----+&quot;</span>
<a name="l00329"></a>00329             &lt;&lt; <span class="stringliteral">&quot;\n | Boundary conditions &quot;</span>
<a name="l00330"></a>00330             &lt;&lt; <span class="stringliteral">&quot;\n +-----+&quot;</span>;
<a name="l00331"></a>00331 
<a name="l00332"></a>00332     std::string bc_name[6] = {<span class="stringliteral">&quot;TOP&quot;</span>, <span class="stringliteral">&quot;BOT&quot;</span>, <span class="stringliteral">&quot;LEFT&quot;</span>, <span class="stringliteral">&quot;RIGHT&quot;</span>, <span class="stringliteral">&quot;FRONT&quot;</span>, <span class="stringliteral">&quot;BACK&quot;</span>};
<a name="l00333"></a>00333     
<a name="l00334"></a>00334     <span class="keyword">typename</span> BC_mapping::iterator pos;
<a name="l00335"></a>00335     <span class="keywordflow">for</span>(pos = dirichlet.begin(); pos !=dirichlet.end(); ++pos) {
<a name="l00336"></a>00336       std::cout&lt;&lt; <span class="stringliteral">&quot;\n | Dirichlet: Wall = &quot;</span> &lt;&lt; bc_name[pos-&gt;first];
<a name="l00337"></a>00337     }
<a name="l00338"></a>00338     <span class="keywordflow">for</span>(pos = neumann.begin(); pos !=neumann.end(); ++pos) {
<a name="l00339"></a>00339       std::cout&lt;&lt; <span class="stringliteral">&quot;\n | Neumann: Wall = &quot;</span> &lt;&lt; bc_name[pos-&gt;first];
<a name="l00340"></a>00340     }
<a name="l00341"></a>00341     asDerived().printInfo();
<a name="l00342"></a>00342 }
<a name="l00343"></a>00343 
<a name="l00350"></a>00350 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Teq&gt;
<a name="l00351"></a><a class="code" href="classTuna_1_1GeneralEquation.html#a25136e525b1fe03af821d085080d4992">00351</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html#a25136e525b1fe03af821d085080d4992" title="Setup Dirichlet boundary conditions on walls.">GeneralEquation&lt;Teq&gt;::setDirichlet</a>(BC_t wall, <a class="code" href="classTuna_1_1GeneralEquation.html#a39e7293ae9e10a2fc90f422da1d28ecd" title="Precision used for the numerical operations.">prec_t</a> w_v)
<a name="l00352"></a>00352 {       
<a name="l00353"></a>00353     dirichlet[wall] = w_v;
<a name="l00354"></a>00354     <span class="keywordflow">switch</span>(wall) {
<a name="l00355"></a>00355     <span class="keywordflow">case</span> RIGHT_WALL : ei--; <span class="keywordflow">break</span>;
<a name="l00356"></a>00356     <span class="keywordflow">case</span> LEFT_WALL  : bi++; <span class="keywordflow">break</span>;
<a name="l00357"></a>00357     <span class="keywordflow">case</span> TOP_WALL   : ej--; <span class="keywordflow">break</span>;
<a name="l00358"></a>00358     <span class="keywordflow">case</span> BOTTOM_WALL: bj++; <span class="keywordflow">break</span>;
<a name="l00359"></a>00359     <span class="keywordflow">case</span> FRONT_WALL : ek--; <span class="keywordflow">break</span>;
<a name="l00360"></a>00360     <span class="keywordflow">case</span> BACK_WALL  : bk++; <span class="keywordflow">break</span>;
<a name="l00361"></a>00361     <span class="keywordflow">default</span>:
<a name="l00362"></a>00362         cout &lt;&lt; <span class="stringliteral">&quot; GeneralEquation: setDirichlet: wall &quot;</span> 
<a name="l00363"></a>00363              &lt;&lt; wall &lt;&lt; <span class="stringliteral">&quot; not defined &quot;</span>&lt;&lt; endl;
<a name="l00364"></a>00364     } 
<a name="l00365"></a>00365 }
<a name="l00366"></a>00366 
<a name="l00373"></a>00373 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Teq&gt;
<a name="l00374"></a><a class="code" href="classTuna_1_1GeneralEquation.html#af5cdc5a89b6c1c314bd203055ff456de">00374</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html#af5cdc5a89b6c1c314bd203055ff456de" title="Setup Neumann boundary conditions on walls.">GeneralEquation&lt;Teq&gt;::setNeumann</a>(BC_t wall, <a class="code" href="classTuna_1_1GeneralEquation.html#a39e7293ae9e10a2fc90f422da1d28ecd" title="Precision used for the numerical operations.">prec_t</a> w_v)
<a name="l00375"></a>00375 {
<a name="l00376"></a>00376     neumann[wall] = w_v;
<a name="l00377"></a>00377     <span class="keywordflow">switch</span>(wall) {
<a name="l00378"></a>00378     <span class="keywordflow">case</span> RIGHT_WALL : ei--; <span class="keywordflow">break</span>;
<a name="l00379"></a>00379     <span class="keywordflow">case</span> LEFT_WALL  : bi++; <span class="keywordflow">break</span>;
<a name="l00380"></a>00380     <span class="keywordflow">case</span> TOP_WALL   : ej--; <span class="keywordflow">break</span>;
<a name="l00381"></a>00381     <span class="keywordflow">case</span> BOTTOM_WALL: bj++; <span class="keywordflow">break</span>;
<a name="l00382"></a>00382     <span class="keywordflow">case</span> FRONT_WALL : ek--; <span class="keywordflow">break</span>;
<a name="l00383"></a>00383     <span class="keywordflow">case</span> BACK_WALL  : bk++; <span class="keywordflow">break</span>;
<a name="l00384"></a>00384     <span class="keywordflow">default</span>:
<a name="l00385"></a>00385         cout &lt;&lt; <span class="stringliteral">&quot; GeneralEquation: setNeumann: wall &quot;</span> 
<a name="l00386"></a>00386              &lt;&lt; wall &lt;&lt; <span class="stringliteral">&quot; not defined &quot;</span>&lt;&lt; endl;
<a name="l00387"></a>00387     }
<a name="l00388"></a>00388 }
<a name="l00389"></a>00389 
<a name="l00390"></a>00390 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Teq&gt;
<a name="l00391"></a>00391 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html" title="General class for equations.">GeneralEquation&lt;Teq&gt;::applyBoundaryConditions</a>() {
<a name="l00392"></a>00392   <span class="keywordflow">if</span>(Dim == 1) {
<a name="l00393"></a>00393     applyDirichlet1D();
<a name="l00394"></a>00394     applyNeumann1D();
<a name="l00395"></a>00395   } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (Dim == 2) {
<a name="l00396"></a>00396     applyDirichlet2D();
<a name="l00397"></a>00397     applyNeumann2D();
<a name="l00398"></a>00398   } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (Dim == 3) {  
<a name="l00399"></a>00399     applyDirichlet3D();
<a name="l00400"></a>00400     applyNeumann3D(); 
<a name="l00401"></a>00401   }
<a name="l00402"></a>00402 }
<a name="l00406"></a>00406 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Teq&gt;
<a name="l00407"></a><a class="code" href="classTuna_1_1GeneralEquation.html#ae0dd56c6ade4cfc084c34ff5fd772c8f">00407</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html#ae0dd56c6ade4cfc084c34ff5fd772c8f" title="Application of Dirichlet and Neumann boundary conditions in 1D.">GeneralEquation&lt;Teq&gt;::applyBoundaryConditions1D</a>() {
<a name="l00408"></a>00408     applyDirichlet1D();
<a name="l00409"></a>00409     applyNeumann1D();
<a name="l00410"></a>00410 }
<a name="l00411"></a>00411 
<a name="l00415"></a>00415 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Teq&gt;
<a name="l00416"></a><a class="code" href="classTuna_1_1GeneralEquation.html#ae2b4682ab94f7bfe3d0a4956962a577e">00416</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html#ae2b4682ab94f7bfe3d0a4956962a577e" title="Application of Dirichlet and Neumann boundary conditions in 2D.">GeneralEquation&lt;Teq&gt;::applyBoundaryConditions2D</a>() {
<a name="l00417"></a>00417     applyDirichlet2D();
<a name="l00418"></a>00418     applyNeumann2D();
<a name="l00419"></a>00419 }
<a name="l00420"></a>00420 
<a name="l00424"></a>00424 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Teq&gt;
<a name="l00425"></a><a class="code" href="classTuna_1_1GeneralEquation.html#a3645e8125190644008ed8848f4ba3caf">00425</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html#a3645e8125190644008ed8848f4ba3caf" title="Application of Dirichlet and Neumann boundary conditions in 3D.">GeneralEquation&lt;Teq&gt;::applyBoundaryConditions3D</a>() {
<a name="l00426"></a>00426     applyDirichlet3D();
<a name="l00427"></a>00427     applyNeumann3D();
<a name="l00428"></a>00428 }
<a name="l00429"></a>00429   
<a name="l00430"></a>00430 
<a name="l00431"></a>00431 <span class="comment">/************************************************************</span>
<a name="l00432"></a>00432 <span class="comment"> *  The same as above but for staggered meshes</span>
<a name="l00433"></a>00433 <span class="comment">/************************************************************/</span>
<a name="l00434"></a>00434 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Teq&gt;
<a name="l00435"></a>00435 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html" title="General class for equations.">GeneralEquation&lt;Teq&gt;::applyBoundaryConditionsStagger1D</a>() {
<a name="l00436"></a>00436     applyDirichletStagger1D();
<a name="l00437"></a>00437     applyNeumann1D();
<a name="l00438"></a>00438 }
<a name="l00439"></a>00439 
<a name="l00440"></a>00440 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Teq&gt;
<a name="l00441"></a>00441 <span class="keyword">inline</span> <span class="keywordtype">void</span> GeneralEquation&lt;Teq&gt;::applyBoundaryConditionsStagger2D(Axis_t axis) {
<a name="l00442"></a>00442     applyDirichletStagger2D(axis);
<a name="l00443"></a>00443     applyNeumann2D();
<a name="l00444"></a>00444 }
<a name="l00445"></a>00445 
<a name="l00446"></a>00446 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Teq&gt;
<a name="l00447"></a>00447 <span class="keyword">inline</span> <span class="keywordtype">void</span> GeneralEquation&lt;Teq&gt;::applyBoundaryConditionsStagger3D(Axis_t axis) {
<a name="l00448"></a>00448     applyDirichletStagger3D(axis);
<a name="l00449"></a>00449     applyNeumann3D();
<a name="l00450"></a>00450 }
<a name="l00451"></a>00451 
<a name="l00452"></a>00452 
<a name="l00460"></a>00460 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Teq&gt;
<a name="l00461"></a><a class="code" href="classTuna_1_1GeneralEquation.html#a7809997f260ee040de62a07629fa574e">00461</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html#a7809997f260ee040de62a07629fa574e" title="Dirichlet boundary condition in 1D.">GeneralEquation&lt;Teq&gt;::applyDirichlet1D</a>()
<a name="l00462"></a>00462 {
<a name="l00463"></a>00463     <span class="keyword">typename</span> BC_mapping::iterator pos;
<a name="l00464"></a>00464     <span class="keywordflow">for</span>(pos = dirichlet.begin(); pos !=dirichlet.end(); ++pos) {
<a name="l00465"></a>00465         <span class="keywordflow">switch</span>(pos-&gt;first) {
<a name="l00466"></a>00466         <span class="keywordflow">case</span> RIGHT_WALL:
<a name="l00467"></a>00467             aP(ei) += aE(ei);
<a name="l00468"></a>00468             sp(ei) += 2 * aE(ei) * phi(ei+1);
<a name="l00469"></a>00469             aE(ei) = 0.0;
<a name="l00470"></a>00470             <span class="keywordflow">break</span>;
<a name="l00471"></a>00471         <span class="keywordflow">case</span> LEFT_WALL:
<a name="l00472"></a>00472             aP(bi) += aW(bi);
<a name="l00473"></a>00473             sp(bi) += 2 * aW(bi) * phi(bi-1);
<a name="l00474"></a>00474             aW(bi) = 0.0;
<a name="l00475"></a>00475             <span class="keywordflow">break</span>;
<a name="l00476"></a>00476         <span class="keywordflow">default</span>:
<a name="l00477"></a>00477             cout &lt;&lt; <span class="stringliteral">&quot; GeneralEquation: applyDirichlet: wall &quot;</span> 
<a name="l00478"></a>00478                  &lt;&lt; pos-&gt;first &lt;&lt; <span class="stringliteral">&quot; not defined &quot;</span>&lt;&lt; endl;
<a name="l00479"></a>00479         }
<a name="l00480"></a>00480     }    
<a name="l00481"></a>00481 }
<a name="l00482"></a>00482 
<a name="l00483"></a>00483 <span class="comment">/************************************************************</span>
<a name="l00484"></a>00484 <span class="comment"> *  The same as above but for staggered meshes</span>
<a name="l00485"></a>00485 <span class="comment">/************************************************************/</span>
<a name="l00486"></a>00486 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Teq&gt;
<a name="l00487"></a>00487 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html" title="General class for equations.">GeneralEquation&lt;Teq&gt;::applyDirichletStagger1D</a>()
<a name="l00488"></a>00488 {
<a name="l00489"></a>00489     <span class="keyword">typename</span> BC_mapping::iterator pos;
<a name="l00490"></a>00490     <span class="keywordflow">for</span>(pos = dirichlet.begin(); pos !=dirichlet.end(); ++pos) {
<a name="l00491"></a>00491         <span class="keywordflow">switch</span>(pos-&gt;first) {
<a name="l00492"></a>00492         <span class="keywordflow">case</span> RIGHT_WALL:
<a name="l00493"></a>00493             sp(ei) += aE(ei) * phi(ei+1);
<a name="l00494"></a>00494             aE(ei) = 0.0;
<a name="l00495"></a>00495             <span class="keywordflow">break</span>;
<a name="l00496"></a>00496         <span class="keywordflow">case</span> LEFT_WALL:
<a name="l00497"></a>00497             sp(bi) += aW(bi) * phi(bi-1);
<a name="l00498"></a>00498             aW(bi) = 0.0;
<a name="l00499"></a>00499             <span class="keywordflow">break</span>;
<a name="l00500"></a>00500         <span class="keywordflow">default</span>:
<a name="l00501"></a>00501             cout &lt;&lt; <span class="stringliteral">&quot; GeneralEquation: applyDirichlet: wall &quot;</span> 
<a name="l00502"></a>00502                  &lt;&lt; pos-&gt;first &lt;&lt; <span class="stringliteral">&quot; not defined &quot;</span>&lt;&lt; endl;
<a name="l00503"></a>00503         }
<a name="l00504"></a>00504     }    
<a name="l00505"></a>00505 }
<a name="l00506"></a>00506 
<a name="l00514"></a>00514 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Teq&gt;
<a name="l00515"></a><a class="code" href="classTuna_1_1GeneralEquation.html#ae9e0bf89858afdba0282be1cbc12b072">00515</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html#ae9e0bf89858afdba0282be1cbc12b072" title="Dirichlet boundary condition in 2D.">GeneralEquation&lt;Teq&gt;::applyDirichlet2D</a>() {
<a name="l00516"></a>00516     Range I(bi,ei), J(bj, ej);
<a name="l00517"></a>00517     <span class="keyword">typename</span> BC_mapping::iterator pos;
<a name="l00518"></a>00518     <span class="keywordflow">for</span>(pos = dirichlet.begin(); pos !=dirichlet.end(); ++pos) {
<a name="l00519"></a>00519         <span class="keywordflow">switch</span>(pos-&gt;first) {
<a name="l00520"></a>00520         <span class="keywordflow">case</span> RIGHT_WALL:
<a name="l00521"></a>00521             aP(ei, J) += aE(ei, J);
<a name="l00522"></a>00522             sp(ei, J) += 2 * aE(ei, J) * phi(ei+1, J);
<a name="l00523"></a>00523             aE(ei, J) = 0.0;
<a name="l00524"></a>00524             <span class="keywordflow">break</span>;
<a name="l00525"></a>00525         <span class="keywordflow">case</span> LEFT_WALL:
<a name="l00526"></a>00526             aP(bi, J) += aW(bi, J);             
<a name="l00527"></a>00527             sp(bi, J) += 2 * aW(bi, J) * phi(bi-1, J);
<a name="l00528"></a>00528             aW(bi, J) = 0.0;
<a name="l00529"></a>00529             <span class="keywordflow">break</span>;
<a name="l00530"></a>00530         <span class="keywordflow">case</span> TOP_WALL:
<a name="l00531"></a>00531             aP(I, ej) += aN(I, ej);
<a name="l00532"></a>00532             sp(I, ej) += 2 * aN(I, ej) * phi(I, ej+1);
<a name="l00533"></a>00533             aN(I, ej) = 0.0;
<a name="l00534"></a>00534             <span class="keywordflow">break</span>;
<a name="l00535"></a>00535         <span class="keywordflow">case</span> BOTTOM_WALL:
<a name="l00536"></a>00536             aP(I, bj) += aS(I, bj);
<a name="l00537"></a>00537             sp(I, bj) += 2 * aS(I, bj) * phi(I, bj-1);
<a name="l00538"></a>00538             aS(I, bj) = 0.0;
<a name="l00539"></a>00539             <span class="keywordflow">break</span>;
<a name="l00540"></a>00540         <span class="keywordflow">default</span>:
<a name="l00541"></a>00541             cout &lt;&lt; <span class="stringliteral">&quot; GeneralEquation: applyDirichlet: wall &quot;</span> 
<a name="l00542"></a>00542                  &lt;&lt; pos-&gt;first &lt;&lt; <span class="stringliteral">&quot; not defined &quot;</span>&lt;&lt; endl;
<a name="l00543"></a>00543         }
<a name="l00544"></a>00544     }
<a name="l00545"></a>00545 
<a name="l00546"></a>00546 }
<a name="l00547"></a>00547 
<a name="l00548"></a>00548 <span class="comment">/************************************************************</span>
<a name="l00549"></a>00549 <span class="comment"> *  The same as above but for staggered meshes</span>
<a name="l00550"></a>00550 <span class="comment">/************************************************************/</span>
<a name="l00551"></a>00551 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Teq&gt;
<a name="l00552"></a>00552 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html" title="General class for equations.">GeneralEquation&lt;Teq&gt;::applyDirichletStagger2D</a>(Axis_t axis) {
<a name="l00553"></a>00553     Range I(bi,ei), J(bj, ej);
<a name="l00554"></a>00554     <span class="keyword">typename</span> BC_mapping::iterator pos;
<a name="l00555"></a>00555     <span class="keywordflow">for</span>(pos = dirichlet.begin(); pos !=dirichlet.end(); ++pos) {
<a name="l00556"></a>00556         <span class="keywordflow">switch</span>(pos-&gt;first) {
<a name="l00557"></a>00557         <span class="keywordflow">case</span> RIGHT_WALL:
<a name="l00558"></a>00558           <span class="keywordflow">if</span>(axis == 0) {
<a name="l00559"></a>00559             sp(ei, J) += aE(ei, J) * phi(ei+1, J);
<a name="l00560"></a>00560             aE(ei, J) = 0.0;
<a name="l00561"></a>00561           }
<a name="l00562"></a>00562           <span class="keywordflow">else</span> {
<a name="l00563"></a>00563             aP(ei, J) += aE(ei, J);
<a name="l00564"></a>00564             sp(ei, J) += 2 * aE(ei, J) * phi(ei+1, J);
<a name="l00565"></a>00565             aE(ei, J) = 0.0;
<a name="l00566"></a>00566           }
<a name="l00567"></a>00567           <span class="keywordflow">break</span>;
<a name="l00568"></a>00568         <span class="keywordflow">case</span> LEFT_WALL:
<a name="l00569"></a>00569           <span class="keywordflow">if</span>(axis == 0) {
<a name="l00570"></a>00570             sp(bi, J) += aW(bi, J) * phi(bi-1, J);
<a name="l00571"></a>00571             aW(bi, J) = 0.0;
<a name="l00572"></a>00572           } 
<a name="l00573"></a>00573           <span class="keywordflow">else</span> {
<a name="l00574"></a>00574             aP(bi, J) += aW(bi, J);             
<a name="l00575"></a>00575             sp(bi, J) += 2 * aW(bi, J) * phi(bi-1, J);
<a name="l00576"></a>00576             aW(bi, J) = 0.0;        
<a name="l00577"></a>00577           }
<a name="l00578"></a>00578           <span class="keywordflow">break</span>;
<a name="l00579"></a>00579         <span class="keywordflow">case</span> TOP_WALL:
<a name="l00580"></a>00580           <span class="keywordflow">if</span>(axis == 1) {
<a name="l00581"></a>00581             sp(I, ej) += aN(I, ej) * phi(I, ej+1);
<a name="l00582"></a>00582             aN(I, ej) = 0.0;
<a name="l00583"></a>00583           } 
<a name="l00584"></a>00584           <span class="keywordflow">else</span> {
<a name="l00585"></a>00585             aP(I, ej) += aN(I, ej);
<a name="l00586"></a>00586             sp(I, ej) += 2 * aN(I, ej) * phi(I, ej+1);
<a name="l00587"></a>00587             aN(I, ej) = 0.0;        
<a name="l00588"></a>00588           }
<a name="l00589"></a>00589           <span class="keywordflow">break</span>;
<a name="l00590"></a>00590         <span class="keywordflow">case</span> BOTTOM_WALL:
<a name="l00591"></a>00591           <span class="keywordflow">if</span>(axis == 1) {
<a name="l00592"></a>00592             sp(I, bj) += aS(I, bj) * phi(I, bj-1);
<a name="l00593"></a>00593             aS(I, bj) = 0.0;
<a name="l00594"></a>00594           }
<a name="l00595"></a>00595           <span class="keywordflow">else</span> {
<a name="l00596"></a>00596             aP(I, bj) += aS(I, bj);
<a name="l00597"></a>00597             sp(I, bj) += 2 * aS(I, bj) * phi(I, bj-1);
<a name="l00598"></a>00598             aS(I, bj) = 0.0;
<a name="l00599"></a>00599           }
<a name="l00600"></a>00600           <span class="keywordflow">break</span>;
<a name="l00601"></a>00601         <span class="keywordflow">default</span>:
<a name="l00602"></a>00602             cout &lt;&lt; <span class="stringliteral">&quot; GeneralEquation: applyDirichlet: wall &quot;</span> 
<a name="l00603"></a>00603                  &lt;&lt; pos-&gt;first &lt;&lt; <span class="stringliteral">&quot; not defined &quot;</span>&lt;&lt; endl;
<a name="l00604"></a>00604         }
<a name="l00605"></a>00605     }
<a name="l00606"></a>00606 }
<a name="l00607"></a>00607 
<a name="l00615"></a>00615 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Teq&gt;
<a name="l00616"></a><a class="code" href="classTuna_1_1GeneralEquation.html#ac362ca4fe4517c17e47b1c3077fdc146">00616</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html#ac362ca4fe4517c17e47b1c3077fdc146" title="Dirichlet boundary condition in 3D.">GeneralEquation&lt;Teq&gt;::applyDirichlet3D</a>()
<a name="l00617"></a>00617 {
<a name="l00618"></a>00618     Range I(bi,ei), J(bj, ej), K(bk, ek);
<a name="l00619"></a>00619     <span class="keyword">typename</span> BC_mapping::iterator pos;
<a name="l00620"></a>00620     <span class="keywordflow">for</span>(pos = dirichlet.begin(); pos !=dirichlet.end(); ++pos) {
<a name="l00621"></a>00621         <span class="keywordflow">switch</span>(pos-&gt;first) {
<a name="l00622"></a>00622         <span class="keywordflow">case</span> RIGHT_WALL:
<a name="l00623"></a>00623             aP(ei,J,K) += aE(ei, J, K);
<a name="l00624"></a>00624             sp(ei,J,K) += 2 * aE(ei,J,K) * phi(ei+1,J,K);
<a name="l00625"></a>00625             aE(ei,J,K) = 0.0;
<a name="l00626"></a>00626             <span class="keywordflow">break</span>;
<a name="l00627"></a>00627         <span class="keywordflow">case</span> LEFT_WALL:
<a name="l00628"></a>00628             aP(bi,J,K) += aW(bi, J, K);
<a name="l00629"></a>00629             sp(bi,J,K) += 2 * aW(bi,J,K) * phi(bi-1,J,K);
<a name="l00630"></a>00630             aW(bi,J,K) = 0.0;
<a name="l00631"></a>00631             <span class="keywordflow">break</span>;
<a name="l00632"></a>00632         <span class="keywordflow">case</span> TOP_WALL:
<a name="l00633"></a>00633             aP(I,ej,K) += aN(I, ej, K);
<a name="l00634"></a>00634             sp(I,ej,K) += 2 * aN(I,ej,K) * phi(I,ej+1,K);
<a name="l00635"></a>00635             aN(I,ej,K) = 0.0;
<a name="l00636"></a>00636             <span class="keywordflow">break</span>;
<a name="l00637"></a>00637         <span class="keywordflow">case</span> BOTTOM_WALL:
<a name="l00638"></a>00638             aP(I,bj,K) += aS(I, bj, K);
<a name="l00639"></a>00639             sp(I,bj,K) += 2 * aS(I,bj,K) * phi(I,bj-1,K);
<a name="l00640"></a>00640             aS(I,bj,K) = 0.0;
<a name="l00641"></a>00641             <span class="keywordflow">break</span>;
<a name="l00642"></a>00642         <span class="keywordflow">case</span> FRONT_WALL:
<a name="l00643"></a>00643             aP(I,J,ek) += aF(I, J, ek);
<a name="l00644"></a>00644             sp(I,J,ek) += 2 * aF(I,J,ek) * phi(I,J,ek+1); 
<a name="l00645"></a>00645             aF(I,J,ek) = 0.0;
<a name="l00646"></a>00646             <span class="keywordflow">break</span>;
<a name="l00647"></a>00647         <span class="keywordflow">case</span> BACK_WALL:
<a name="l00648"></a>00648             aP(I,J,bk) += aB(I, J, bk);
<a name="l00649"></a>00649             sp(I,J,bk) += 2 * aB(I,J,bk) * phi(I,J,bk-1);
<a name="l00650"></a>00650             aB(I,J,bk) = 0.0;
<a name="l00651"></a>00651             <span class="keywordflow">break</span>;
<a name="l00652"></a>00652         <span class="keywordflow">default</span>:
<a name="l00653"></a>00653             cout &lt;&lt; <span class="stringliteral">&quot; GeneralEquation: applyDirichlet: wall &quot;</span> 
<a name="l00654"></a>00654                  &lt;&lt; pos-&gt;first &lt;&lt; <span class="stringliteral">&quot; not defined &quot;</span>
<a name="l00655"></a>00655                  &lt;&lt; name &lt;&lt; endl;
<a name="l00656"></a>00656         }
<a name="l00657"></a>00657     }
<a name="l00658"></a>00658 }
<a name="l00659"></a>00659 
<a name="l00660"></a>00660 <span class="comment">/************************************************************</span>
<a name="l00661"></a>00661 <span class="comment"> *  The same as above but for staggered meshes</span>
<a name="l00662"></a>00662 <span class="comment">/************************************************************/</span>
<a name="l00663"></a>00663 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Teq&gt;
<a name="l00664"></a>00664 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html" title="General class for equations.">GeneralEquation&lt;Teq&gt;::applyDirichletStagger3D</a>(Axis_t axis)
<a name="l00665"></a>00665 {
<a name="l00666"></a>00666     Range I(bi,ei), J(bj, ej), K(bk, ek);
<a name="l00667"></a>00667     <span class="keyword">typename</span> BC_mapping::iterator pos;
<a name="l00668"></a>00668     <span class="keywordflow">for</span>(pos = dirichlet.begin(); pos !=dirichlet.end(); ++pos) {
<a name="l00669"></a>00669         <span class="keywordflow">switch</span>(pos-&gt;first) {
<a name="l00670"></a>00670         <span class="keywordflow">case</span> RIGHT_WALL:
<a name="l00671"></a>00671           <span class="keywordflow">if</span>(axis == 0) {
<a name="l00672"></a>00672             sp(ei,J,K) += aE(ei,J,K) * phi(ei+1,J,K);
<a name="l00673"></a>00673             aE(ei,J,K) = 0.0;
<a name="l00674"></a>00674           } 
<a name="l00675"></a>00675           <span class="keywordflow">else</span> {
<a name="l00676"></a>00676             aP(ei,J,K) += aE(ei, J, K);
<a name="l00677"></a>00677             sp(ei,J,K) += 2 * aE(ei,J,K) * phi(ei+1,J,K);
<a name="l00678"></a>00678             aE(ei,J,K) = 0.0;
<a name="l00679"></a>00679           }
<a name="l00680"></a>00680           <span class="keywordflow">break</span>;
<a name="l00681"></a>00681         <span class="keywordflow">case</span> LEFT_WALL:
<a name="l00682"></a>00682           <span class="keywordflow">if</span>(axis == 0) {
<a name="l00683"></a>00683             sp(bi,J,K) += aW(bi,J,K) * phi(bi-1,J,K);
<a name="l00684"></a>00684             aW(bi,J,K) = 0.0;       
<a name="l00685"></a>00685           }
<a name="l00686"></a>00686           <span class="keywordflow">else</span> {
<a name="l00687"></a>00687             aP(bi,J,K) += aW(bi, J, K);
<a name="l00688"></a>00688             sp(bi,J,K) += 2 * aW(bi,J,K) * phi(bi-1,J,K);
<a name="l00689"></a>00689             aW(bi,J,K) = 0.0;
<a name="l00690"></a>00690           }
<a name="l00691"></a>00691           <span class="keywordflow">break</span>;
<a name="l00692"></a>00692         <span class="keywordflow">case</span> TOP_WALL:
<a name="l00693"></a>00693           <span class="keywordflow">if</span>(axis == 1) {
<a name="l00694"></a>00694             sp(I,ej,K) += aN(I,ej,K) * phi(I,ej+1,K);
<a name="l00695"></a>00695             aN(I,ej,K) = 0.0;
<a name="l00696"></a>00696           }
<a name="l00697"></a>00697           <span class="keywordflow">else</span> {
<a name="l00698"></a>00698             aP(I,ej,K) += aN(I, ej, K);
<a name="l00699"></a>00699             sp(I,ej,K) += 2 * aN(I,ej,K) * phi(I,ej+1,K);
<a name="l00700"></a>00700             aN(I,ej,K) = 0.0;
<a name="l00701"></a>00701           }
<a name="l00702"></a>00702           <span class="keywordflow">break</span>;
<a name="l00703"></a>00703         <span class="keywordflow">case</span> BOTTOM_WALL:
<a name="l00704"></a>00704           <span class="keywordflow">if</span>(axis == 1) {
<a name="l00705"></a>00705             sp(I,bj,K) += aS(I,bj,K) * phi(I,bj-1,K);
<a name="l00706"></a>00706             aS(I,bj,K) = 0.0;
<a name="l00707"></a>00707           }
<a name="l00708"></a>00708           <span class="keywordflow">else</span> {
<a name="l00709"></a>00709             aP(I,bj,K) += aS(I, bj, K);
<a name="l00710"></a>00710             sp(I,bj,K) += 2 * aS(I,bj,K) * phi(I,bj-1,K);
<a name="l00711"></a>00711             aS(I,bj,K) = 0.0;
<a name="l00712"></a>00712           }
<a name="l00713"></a>00713           <span class="keywordflow">break</span>;
<a name="l00714"></a>00714         <span class="keywordflow">case</span> FRONT_WALL:
<a name="l00715"></a>00715           <span class="keywordflow">if</span>(axis == 2) {
<a name="l00716"></a>00716             sp(I,J,ek) += aF(I,J,ek) * phi(I,J,ek+1); 
<a name="l00717"></a>00717             aF(I,J,ek) = 0.0;       
<a name="l00718"></a>00718           }
<a name="l00719"></a>00719           <span class="keywordflow">else</span> {
<a name="l00720"></a>00720             aP(I,J,ek) += aF(I, J, ek);
<a name="l00721"></a>00721             sp(I,J,ek) += 2 * aF(I,J,ek) * phi(I,J,ek+1); 
<a name="l00722"></a>00722             aF(I,J,ek) = 0.0;
<a name="l00723"></a>00723           }
<a name="l00724"></a>00724           <span class="keywordflow">break</span>;
<a name="l00725"></a>00725         <span class="keywordflow">case</span> BACK_WALL:
<a name="l00726"></a>00726           <span class="keywordflow">if</span>(axis == 2) {
<a name="l00727"></a>00727             sp(I,J,bk) += aB(I,J,bk) * phi(I,J,bk-1);
<a name="l00728"></a>00728             aB(I,J,bk) = 0.0;       
<a name="l00729"></a>00729           } 
<a name="l00730"></a>00730           <span class="keywordflow">else</span> {
<a name="l00731"></a>00731             aP(I,J,bk) += aB(I, J, bk);
<a name="l00732"></a>00732             sp(I,J,bk) += 2 * aB(I,J,bk) * phi(I,J,bk-1);
<a name="l00733"></a>00733             aB(I,J,bk) = 0.0;
<a name="l00734"></a>00734           }
<a name="l00735"></a>00735           <span class="keywordflow">break</span>;
<a name="l00736"></a>00736         <span class="keywordflow">default</span>:
<a name="l00737"></a>00737             cout &lt;&lt; <span class="stringliteral">&quot; GeneralEquation: applyDirichlet: wall &quot;</span> 
<a name="l00738"></a>00738                  &lt;&lt; pos-&gt;first &lt;&lt; <span class="stringliteral">&quot; not defined &quot;</span>
<a name="l00739"></a>00739                  &lt;&lt; name &lt;&lt; endl;
<a name="l00740"></a>00740         }
<a name="l00741"></a>00741     }
<a name="l00742"></a>00742 }
<a name="l00743"></a>00743 
<a name="l00751"></a>00751 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Teq&gt;
<a name="l00752"></a><a class="code" href="classTuna_1_1GeneralEquation.html#a9e817253cb759e787244a4b917ee2ee9">00752</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html#a9e817253cb759e787244a4b917ee2ee9" title="Neumann boundary condition in 1D.">GeneralEquation&lt;Teq&gt;::applyNeumann1D</a>()
<a name="l00753"></a>00753 { 
<a name="l00754"></a>00754     <span class="keyword">typename</span> BC_mapping::iterator pos;
<a name="l00755"></a>00755     <span class="keywordflow">for</span>(pos = neumann.begin(); pos !=neumann.end(); ++pos) {
<a name="l00756"></a>00756         <span class="keywordflow">switch</span>(pos-&gt;first) {
<a name="l00757"></a>00757         <span class="keywordflow">case</span> RIGHT_WALL:
<a name="l00758"></a>00758             aP(ei) -= aE(ei);
<a name="l00759"></a>00759             sp(ei) += aE(ei) * dx * neumann[RIGHT_WALL];
<a name="l00760"></a>00760             aE(ei) = 0.0;
<a name="l00761"></a>00761             <span class="keywordflow">break</span>;
<a name="l00762"></a>00762         <span class="keywordflow">case</span> LEFT_WALL:
<a name="l00763"></a>00763             aP(bi) -= aW(bi);
<a name="l00764"></a>00764             sp(bi) -= aW(bi) * dx * neumann[LEFT_WALL];
<a name="l00765"></a>00765             aW(bi) = 0.0;
<a name="l00766"></a>00766             <span class="keywordflow">break</span>;
<a name="l00767"></a>00767         <span class="keywordflow">default</span>:
<a name="l00768"></a>00768             cout &lt;&lt; <span class="stringliteral">&quot; GeneralEquation: applyNeumann : wall &quot;</span> 
<a name="l00769"></a>00769                  &lt;&lt; pos-&gt;first &lt;&lt; <span class="stringliteral">&quot; not defined &quot;</span>&lt;&lt; endl;
<a name="l00770"></a>00770         }
<a name="l00771"></a>00771     }
<a name="l00772"></a>00772 }
<a name="l00773"></a>00773 
<a name="l00774"></a>00774 
<a name="l00782"></a>00782 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Teq&gt;
<a name="l00783"></a><a class="code" href="classTuna_1_1GeneralEquation.html#ae11b4f1d25e239aba5e7feee69ab20dc">00783</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html#ae11b4f1d25e239aba5e7feee69ab20dc" title="Neumann boundary condition in 2D.">GeneralEquation&lt;Teq&gt;::applyNeumann2D</a>()
<a name="l00784"></a>00784 {
<a name="l00785"></a>00785   Range I(bi,ei), J(bj, ej);
<a name="l00786"></a>00786   <span class="comment">//    Range I(bi-1,ei+1), J(bj-1, ej+1);</span>
<a name="l00787"></a>00787     <span class="keyword">typename</span> BC_mapping::iterator pos;
<a name="l00788"></a>00788     <span class="keywordflow">for</span>(pos = neumann.begin(); pos !=neumann.end(); ++pos) {
<a name="l00789"></a>00789         <span class="keywordflow">switch</span>(pos-&gt;first) {
<a name="l00790"></a>00790         <span class="keywordflow">case</span> RIGHT_WALL:
<a name="l00791"></a>00791             aP(ei, J) -= aE(ei, J);
<a name="l00792"></a>00792             sp(ei, J) += aE(ei, J) * dx * neumann[RIGHT_WALL];
<a name="l00793"></a>00793             aE(ei, J) = 0.0;
<a name="l00794"></a>00794             <span class="keywordflow">break</span>;
<a name="l00795"></a>00795         <span class="keywordflow">case</span> LEFT_WALL:
<a name="l00796"></a>00796             aP(bi, J) -= aW(bi, J);
<a name="l00797"></a>00797             sp(bi, J) -= aW(bi, J) * dx * neumann[LEFT_WALL];
<a name="l00798"></a>00798             aW(bi, J) = 0.0;
<a name="l00799"></a>00799             <span class="keywordflow">break</span>;
<a name="l00800"></a>00800         <span class="keywordflow">case</span> TOP_WALL:
<a name="l00801"></a>00801             aP(I, ej) -= aN(I, ej);
<a name="l00802"></a>00802             sp(I, ej) += aN(I, ej) * dy * neumann[TOP_WALL];
<a name="l00803"></a>00803             aN(I, ej) = 0.0;
<a name="l00804"></a>00804             <span class="keywordflow">break</span>;
<a name="l00805"></a>00805         <span class="keywordflow">case</span> BOTTOM_WALL:
<a name="l00806"></a>00806             aP(I, bj) -= aS(I, bj);
<a name="l00807"></a>00807             sp(I, bj) -= aS(I, bj) * dy * neumann[BOTTOM_WALL];
<a name="l00808"></a>00808             aS(I, bj) = 0.0;
<a name="l00809"></a>00809             <span class="keywordflow">break</span>;
<a name="l00810"></a>00810         <span class="keywordflow">default</span>:
<a name="l00811"></a>00811             cout &lt;&lt; <span class="stringliteral">&quot; GeneralEquation: applyNeumann : wall &quot;</span> 
<a name="l00812"></a>00812                  &lt;&lt; pos-&gt;first &lt;&lt; <span class="stringliteral">&quot; not defined &quot;</span>&lt;&lt; endl;
<a name="l00813"></a>00813         }
<a name="l00814"></a>00814     }
<a name="l00815"></a>00815 }
<a name="l00816"></a>00816 
<a name="l00824"></a>00824 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Teq&gt;
<a name="l00825"></a><a class="code" href="classTuna_1_1GeneralEquation.html#a9ad19dbf5779b235447ac056514b4eb9">00825</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html#a9ad19dbf5779b235447ac056514b4eb9" title="Neumann boundary condition in 3D.">GeneralEquation&lt;Teq&gt;::applyNeumann3D</a>() {
<a name="l00826"></a>00826     Range I(bi,ei), J(bj, ej), K(bk, ek);
<a name="l00827"></a>00827     <span class="keyword">typename</span> BC_mapping::iterator pos;
<a name="l00828"></a>00828     <span class="keywordflow">for</span>(pos = neumann.begin(); pos !=neumann.end(); ++pos) {
<a name="l00829"></a>00829         <span class="keywordflow">switch</span>(pos-&gt;first) {
<a name="l00830"></a>00830         <span class="keywordflow">case</span> RIGHT_WALL:
<a name="l00831"></a>00831             aP(ei, J, K) -= aE(ei, J, K);
<a name="l00832"></a>00832             sp(ei, J, K) += aE(ei, J, K) * dx * neumann[RIGHT_WALL];
<a name="l00833"></a>00833             aE(ei, J, K) = 0.0;
<a name="l00834"></a>00834             <span class="keywordflow">break</span>;
<a name="l00835"></a>00835         <span class="keywordflow">case</span> LEFT_WALL:
<a name="l00836"></a>00836             aP(bi, J, K) -= aW(bi, J, K);
<a name="l00837"></a>00837             sp(bi, J, K) -= aW(bi, J, K) * dx * neumann[LEFT_WALL];
<a name="l00838"></a>00838             aW(bi, J, K) = 0.0;
<a name="l00839"></a>00839             <span class="keywordflow">break</span>;
<a name="l00840"></a>00840         <span class="keywordflow">case</span> TOP_WALL:
<a name="l00841"></a>00841             aP(I, ej, K) -= aN(I, ej, K);
<a name="l00842"></a>00842             sp(I, ej, K) += aN(I, ej, K) * dy * neumann[TOP_WALL];
<a name="l00843"></a>00843             aN(I, ej, K) = 0.0;
<a name="l00844"></a>00844             <span class="keywordflow">break</span>;
<a name="l00845"></a>00845         <span class="keywordflow">case</span> BOTTOM_WALL:
<a name="l00846"></a>00846             aP(I, bj, K) -= aS(I, bj, K);
<a name="l00847"></a>00847             sp(I, bj, K) -= aS(I, bj, K) * dy * neumann[BOTTOM_WALL];
<a name="l00848"></a>00848             aS(I, bj, K) = 0.0;
<a name="l00849"></a>00849             <span class="keywordflow">break</span>;
<a name="l00850"></a>00850         <span class="keywordflow">case</span> FRONT_WALL:
<a name="l00851"></a>00851             aP(I, J, ek) -= aF(I, J, ek);
<a name="l00852"></a>00852             sp(I, J, ek) += aF(I, J, ek) * dz * neumann[FRONT_WALL];
<a name="l00853"></a>00853             aF(I, J, ek) = 0.0;
<a name="l00854"></a>00854             <span class="keywordflow">break</span>;
<a name="l00855"></a>00855         <span class="keywordflow">case</span> BACK_WALL:
<a name="l00856"></a>00856             aP(I, J, bk) -= aB(I, J, bk);
<a name="l00857"></a>00857             sp(I, J, bk) -= aB(I, J, bk) * dz * neumann[BACK_WALL];
<a name="l00858"></a>00858             aB(I, J, bk) = 0.0;
<a name="l00859"></a>00859             <span class="keywordflow">break</span>;
<a name="l00860"></a>00860         <span class="keywordflow">default</span>:
<a name="l00861"></a>00861             cout &lt;&lt; <span class="stringliteral">&quot; GeneralEquation: applyNeumann : wall &quot;</span> 
<a name="l00862"></a>00862                  &lt;&lt; pos-&gt;first &lt;&lt; <span class="stringliteral">&quot; not defined &quot;</span>&lt;&lt; endl;
<a name="l00863"></a>00863         }
<a name="l00864"></a>00864     }
<a name="l00865"></a>00865 }
<a name="l00866"></a>00866 
<a name="l00867"></a>00867 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Teq&gt;
<a name="l00868"></a>00868 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTuna_1_1GeneralEquation.html" title="General class for equations.">GeneralEquation&lt;Teq&gt;::update</a>()
<a name="l00869"></a>00869 {
<a name="l00870"></a>00870 
<a name="l00871"></a>00871   <span class="comment">// First we apply the Neumann conditions, if any...</span>
<a name="l00872"></a>00872     <span class="keyword">typename</span> BC_mapping::iterator pos;
<a name="l00873"></a>00873     Range I(bi-1,ei+1), J(bj-1, ej+1), K(bk-1, ek+1);
<a name="l00874"></a>00874 
<a name="l00875"></a>00875     <span class="keywordflow">if</span> (Dim == 1) {
<a name="l00876"></a>00876       <span class="keywordflow">for</span>(pos = neumann.begin(); pos !=neumann.end(); ++pos) {
<a name="l00877"></a>00877         <span class="keywordflow">switch</span>(pos-&gt;first) {
<a name="l00878"></a>00878         <span class="keywordflow">case</span> RIGHT_WALL:
<a name="l00879"></a>00879           phi(ei+1) = phi(ei) + neumann[RIGHT_WALL] * dx * 0.5;
<a name="l00880"></a>00880           <span class="keywordflow">break</span>;
<a name="l00881"></a>00881         <span class="keywordflow">case</span> LEFT_WALL:
<a name="l00882"></a>00882           phi(bi-1) = phi(bi) - neumann[LEFT_WALL] * dx * 0.5;
<a name="l00883"></a>00883           <span class="keywordflow">break</span>;
<a name="l00884"></a>00884         <span class="keywordflow">default</span>:
<a name="l00885"></a>00885           cout &lt;&lt; <span class="stringliteral">&quot; GeneralEquation: applyNeumann : wall &quot;</span> 
<a name="l00886"></a>00886                &lt;&lt; pos-&gt;first &lt;&lt; <span class="stringliteral">&quot; not defined &quot;</span>&lt;&lt; endl;
<a name="l00887"></a>00887         }
<a name="l00888"></a>00888       }
<a name="l00889"></a>00889     }
<a name="l00890"></a>00890 
<a name="l00891"></a>00891     <span class="keywordflow">if</span> (Dim == 2) {
<a name="l00892"></a>00892       <span class="keywordflow">for</span>(pos = neumann.begin(); pos !=neumann.end(); ++pos) {
<a name="l00893"></a>00893         <span class="keywordflow">switch</span>(pos-&gt;first) {
<a name="l00894"></a>00894         <span class="keywordflow">case</span> RIGHT_WALL:
<a name="l00895"></a>00895           phi(ei+1, J) = phi(ei, J) + neumann[RIGHT_WALL] * dx * 0.5;
<a name="l00896"></a>00896           <span class="keywordflow">break</span>;
<a name="l00897"></a>00897         <span class="keywordflow">case</span> LEFT_WALL:
<a name="l00898"></a>00898           phi(bi-1, J) = phi(bi, J) - neumann[LEFT_WALL] * dx * 0.5;
<a name="l00899"></a>00899           <span class="keywordflow">break</span>;
<a name="l00900"></a>00900         <span class="keywordflow">case</span> TOP_WALL:
<a name="l00901"></a>00901           phi(I, ej+1) = phi(I, ej) + neumann[TOP_WALL] * dy * 0.5;
<a name="l00902"></a>00902           <span class="keywordflow">break</span>;
<a name="l00903"></a>00903         <span class="keywordflow">case</span> BOTTOM_WALL:
<a name="l00904"></a>00904           phi(I, bj-1) = phi(I, bj) - neumann[BOTTOM_WALL] * dy * 0.5;
<a name="l00905"></a>00905           <span class="keywordflow">break</span>;
<a name="l00906"></a>00906         <span class="keywordflow">default</span>:
<a name="l00907"></a>00907             cout &lt;&lt; <span class="stringliteral">&quot; GeneralEquation: applyNeumann : wall &quot;</span> 
<a name="l00908"></a>00908                  &lt;&lt; pos-&gt;first &lt;&lt; <span class="stringliteral">&quot; not defined &quot;</span>&lt;&lt; endl;
<a name="l00909"></a>00909         }
<a name="l00910"></a>00910       }
<a name="l00911"></a>00911     }
<a name="l00912"></a>00912 
<a name="l00913"></a>00913     <span class="keywordflow">if</span> (Dim == 3) {
<a name="l00914"></a>00914       <span class="keywordflow">for</span>(pos = neumann.begin(); pos !=neumann.end(); ++pos) {
<a name="l00915"></a>00915         <span class="keywordflow">switch</span>(pos-&gt;first) {
<a name="l00916"></a>00916         <span class="keywordflow">case</span> RIGHT_WALL:
<a name="l00917"></a>00917           phi(ei+1, J, K) = phi(ei, J, K) + neumann[RIGHT_WALL] * dx * 0.5;
<a name="l00918"></a>00918           <span class="keywordflow">break</span>;
<a name="l00919"></a>00919         <span class="keywordflow">case</span> LEFT_WALL:
<a name="l00920"></a>00920           phi(bi-1, J, K) = phi(bi, J, K) - neumann[LEFT_WALL] * dx * 0.5;
<a name="l00921"></a>00921           <span class="keywordflow">break</span>;
<a name="l00922"></a>00922         <span class="keywordflow">case</span> TOP_WALL:
<a name="l00923"></a>00923           phi(I, ej+1, K) = phi(I, ej, K) + neumann[TOP_WALL] * dy * 0.5;
<a name="l00924"></a>00924           <span class="keywordflow">break</span>;
<a name="l00925"></a>00925         <span class="keywordflow">case</span> BOTTOM_WALL:
<a name="l00926"></a>00926           phi(I, bj-1, K) = phi(I, bj, K) - neumann[BOTTOM_WALL] * dy * 0.5;
<a name="l00927"></a>00927           <span class="keywordflow">break</span>;
<a name="l00928"></a>00928         <span class="keywordflow">case</span> FRONT_WALL:
<a name="l00929"></a>00929           phi(I, J, ek+1) = phi(I, J, ek) + neumann[FRONT_WALL] * dz * 0.5;
<a name="l00930"></a>00930           <span class="keywordflow">break</span>;
<a name="l00931"></a>00931         <span class="keywordflow">case</span> BACK_WALL:
<a name="l00932"></a>00932           phi(I, J, bk-1) = phi(I, J, bk) - neumann[BACK_WALL] * dz * 0.5;
<a name="l00933"></a>00933           <span class="keywordflow">break</span>;
<a name="l00934"></a>00934         <span class="keywordflow">default</span>:
<a name="l00935"></a>00935             cout &lt;&lt; <span class="stringliteral">&quot; GeneralEquation: applyNeumann : wall &quot;</span> 
<a name="l00936"></a>00936                  &lt;&lt; pos-&gt;first &lt;&lt; <span class="stringliteral">&quot; not defined &quot;</span>&lt;&lt; endl;
<a name="l00937"></a>00937         }
<a name="l00938"></a>00938       }
<a name="l00939"></a>00939     }
<a name="l00940"></a>00940 
<a name="l00941"></a>00941     <span class="comment">// update phi_0 global using the solution stored in phi.   </span>
<a name="l00942"></a>00942     phi_0 = phi;
<a name="l00943"></a>00943 }
<a name="l00944"></a>00944 
<a name="l00945"></a>00945 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Teq&gt;
<a name="l00946"></a>00946 <span class="keywordtype">double</span> GeneralEquation&lt;Teq&gt;::calcResidual() 
<a name="l00947"></a>00947 {
<a name="l00948"></a>00948     Range I(bi, ei), J(bj, ej), K(bk, ek);      
<a name="l00949"></a>00949     <span class="keyword">static</span> ScalarField acum(aP.shape());
<a name="l00950"></a>00950     acum = 0.0;
<a name="l00951"></a>00951     
<a name="l00952"></a>00952     <span class="keywordtype">int</span> num_grid_points = (ei - bi) * (ej - bj) * (ek -bk);
<a name="l00953"></a>00953     <span class="keywordtype">double</span> NINV = 1.0 / num_grid_points;
<a name="l00954"></a>00954 
<a name="l00955"></a>00955     <span class="keywordflow">if</span> ( Dim == 1 ) {
<a name="l00956"></a>00956         acum(I) = aE(I) * phi(I+1) + aW(I) * phi(I-1) +
<a name="l00957"></a>00957             sp(I) - aP(I) * phi(I);
<a name="l00958"></a>00958     }
<a name="l00959"></a>00959     
<a name="l00960"></a>00960     <span class="keywordflow">if</span> ( Dim == 2 ) {
<a name="l00961"></a>00961         acum(I,J) = aE(I,J) * phi(I+1,J) + aW(I,J) * phi(I-1,J) +
<a name="l00962"></a>00962             aN(I,J) * phi(I,J+1) + aS(I,J) * phi(I,J-1) +
<a name="l00963"></a>00963             sp(I,J) - aP(I,J) * phi(I,J);
<a name="l00964"></a>00964     }
<a name="l00965"></a>00965 
<a name="l00966"></a>00966     <span class="keywordflow">if</span> ( Dim == 3 ) {
<a name="l00967"></a>00967         acum(I,J,K) = aE(I,J,K) * phi(I+1,J,K) + aW(I,J,K) * phi(I-1,J,K)
<a name="l00968"></a>00968             + aN(I,J,K) * phi(I,J+1,K) + aS(I,J,K) * phi(I,J-1,K) 
<a name="l00969"></a>00969             + aF(I,J,K) * phi(I,J,K+1) + aB(I,J,K) * phi(I,J,K-1);
<a name="l00970"></a>00970         acum(I,J,K) += sp(I,J,K) - aP(I,J,K) * phi(I,J,K);
<a name="l00971"></a>00971     }    
<a name="l00972"></a>00972 <span class="comment">// L2-Norm</span>
<a name="l00973"></a>00973     residual = sqrt( NINV * sum(acum * acum) );
<a name="l00974"></a>00974 <span class="comment">//      residual = NINV * sqrt( sum(acum * acum) );</span>
<a name="l00975"></a>00975 <span class="comment">// L1-Norm</span>
<a name="l00976"></a>00976 <span class="comment">//      residual = NINV * sum( abs(acum) );</span>
<a name="l00977"></a>00977 <span class="comment">// Lmax-Norm</span>
<a name="l00978"></a>00978 <span class="comment">//      residual = max ( abs(acum) );</span>
<a name="l00979"></a>00979     <span class="keywordflow">return</span> residual;
<a name="l00980"></a>00980 }
<a name="l00981"></a>00981 
<a name="l00982"></a>00982 
<a name="l00983"></a>00983 } <span class="comment">// namespace Tuna</span>
<a name="l00984"></a>00984 
<a name="l00985"></a>00985 <span class="preprocessor">#endif //_GENERALEQUATION_H_</span>
<a name="l00986"></a>00986 <span class="preprocessor"></span>
<a name="l00987"></a>00987 
<a name="l00988"></a>00988 
<a name="l00989"></a>00989 
<a name="l00990"></a>00990 
<a name="l00991"></a>00991 
<a name="l00992"></a>00992 
<a name="l00993"></a>00993 
<a name="l00994"></a>00994 
<a name="l00995"></a>00995 
<a name="l00996"></a>00996 
</pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr size="1">
<div align="center">
Last modification: Sun Aug 28 09:57:21 CDT 2011
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&copy; 2011 LMCS-UNAM
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Generated by <a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="top" border="0" height="25"></a> 1.6.1 </div>

